package com.zoo.service;

import com.axq.common.usermanager.login.AbstractLoginServer;
import com.axq.common.usermanager.login.dto.UserDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Xiao Qiang
 * @Class: ${file_name}
 * @Description: ${todo}
 * @date 2020/8/21 10:20
 */
@Service
public class LoginServer extends AbstractLoginServer {

    /**
     * 用户名密码验证
     * @param userDto
     * @return
     */
    @Override
    protected String loginExt(UserDto userDto) {
//      throw new BaseBusinessException(ResponseCode.EMPTY_MESSAGE, "用户名密码错误");
        if (StringUtils.equals("Owen", userDto.getAccount())) {
            return "Owen";
        }
        return StringUtils.EMPTY;
    }

    /**
     * 查询当前角色对应的权限
     * @param roleId
     * @return
     */
    @Override
    protected List<String> queryFunctions(String roleId) {
        List<String> list = new ArrayList<>();
        if (StringUtils.equals("Owen", roleId)) {
            list.add("001");
            list.add("002");
            return list;
        }
        return list;
    }
}
